<?php
/*
 *author:Yangligao
 *Date:2013-9-26
 */
require '../../Config.php';
$flag = $_GET['flag'];
$joinCpModel = new JoinCpModel();
if($flag == 'display'){
	$cp_id = $_GET['id'];
	$res = $joinCpModel->joincp_select('*',"where cp_id={$cp_id}");
	$smarty->assign("cpData",$res);
	$smarty->display('Admin/CpM/cpupdate.html');
}else if($flag == 'cpupdate'){
	if($_FILES['pic']['size'] != 0){
		$upload = new Upload();
		$picPath = $upload->savePic("../Upload");
		$_POST['cp_pic'] = $picPath;
	}
	printArr($_POST);
	unset($_POST['x']);
	unset($_POST['y']);
	$res = $joinCpModel->joincp_update($_POST);
	if($res){
		jump('操作成功！', $_SERVER['HTTP_REFERER']);
	}else{
		alertInfo('操作失败', $_SERVER['HTTP_REFERER']);
	}
}
?>
